﻿<%@ page contentType="text/html; charset=utf-8" %>
<!DOCTYPE HTML>
<html>
<head>
    <%@include file="/common/taglibs.jsp" %>
    <meta charset="utf-8"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <meta http-equiv="pragma" content="no-cache"/>
    <meta name="keywords" content="H-ui.admin v2.3,H-ui网站后台模版,后台模版下载,后台管理系统模版,HTML后台模版下载">
    <meta name="description" content="H-ui.admin v2.3，是一款由国人开发的轻量级扁平化网站后台模板，完全免费开源的网站后台管理系统模版，适合中小型CMS后台系统。">
    <LINK rel="Bookmark" href="/favicon.ico">
    <LINK rel="Shortcut Icon" href="/favicon.ico"/>
    <%@include file="/common/css.jsp"%>
    <link href="${ctx }/lib/icheck/icheck.css" rel="stylesheet" type="text/css">
    <link href="${ctx }/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css">
    <title>H-ui.admin v2.3</title>
</head>
<body>
<%@include file="/common/top.jsp" %>
<%@include file="/common/menu.jsp" %>
<section class="Hui-article-box">
    <div class="Hui-article">
        <div class="cl pd-20">
            <div class="text-c">
                <form id="formsearch" action="${ctx }/res/gotoResourceView" method="post">
                    <input type="hidden" name="pageNo" value="${page.pageNo }"/>
                    <input type="text" name="searchKey" id="search_key" placeholder="所属类、所调方法" style="width:250px"
                           class="input-text">
                    <a name="" id="search_resource" class="btn btn-secondary"><i class="Hui-iconfont">&#xe665;</i>查询</a>
                </form>
            </div>
            <div class="mt-20">
                <shiro:hasPermission name="addUser">
                    <a class="btn btn-primary size-S" id="addNewUser_btn">新增用户</a>
                </shiro:hasPermission>
                <shiro:hasPermission name="refreshUserAuth">
                    <a class="btn btn-primary size-S" id="refreshUserAuth_btn">刷新权限</a>
                </shiro:hasPermission>
                <table class="table table-border table-bordered table-hover table-bg">
                    <thead>
                    <tr class="text-c">
                        <th width="50">序列</th>
                        <th width="180">用户账号</th>
                        <th width="200">用户名称</th>
                        <th width="180">联系电话</th>
                        <th>邮箱</th>
                        <th width="80">状态</th>
                        <th width="50">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <c:forEach items="${page.data }" var="user" varStatus="status">
                        <tr class="text-c">
                            <td>${status.index+1}</td>
                            <td field="username">${user.username }</td>
                            <td field="realname">${user.realname }</td>
                            <td field="phone">${user.phone}</td>
                            <td field="email">${user.email}</td>
                            <td>${user.chineseStatus}</td>
                            <td class="f-14">
                                <div class="dropDown right dropDown_click">
                                    <a class="btn btn-link size-MINI" href="#">操作</a>
                                    <div class="dropDown-menu box-shadow">
                                        <ul>
                                            <%--校验详细信按钮息权限--%>
                                            <shiro:hasPermission name="userInfo">
                                                <li><a href="#" name="show_info_btn" data-id="${user.id}">详请</a></li>
                                            </shiro:hasPermission>
                                            <%--校验修改按钮权限--%>
                                            <shiro:hasPermission name="updUser">
                                                <c:if test="${'0'!=user.status}">
                                                    <li><a href="#" name="upd_user_btn" data-id="${user.id}">修改</a></li>
                                                </c:if>
                                            </shiro:hasPermission>
                                            <%--校验删除按钮权限--%>
                                            <shiro:hasPermission name="delUser">
                                                <c:if test="${'0'!=user.status}">
                                                    <li><a href="#" name="user_delete_btn" data-id="${user.id}">删除</a></li>
                                                </c:if>
                                            </shiro:hasPermission>
                                            <%--校验激活按钮权限--%>
                                            <shiro:hasPermission name="userActivate">
                                                <%--判断激活按钮出现条件--%>
                                                <c:if test="${'1'!=user.status}">
                                                    <li><a href="#" name="activate_btn" data-id="${user.id}">激活</a></li>
                                                </c:if>
                                            </shiro:hasPermission>
                                            <%--校验取消激活按钮权限--%>
                                            <shiro:hasPermission name="userFrozen">
                                                <%--判断取消激活按钮出现条件--%>
                                                <c:if test="${'2'!=user.status and '0'!=user.status }">
                                                    <li><a href="#" name="frozen_btn" data-id="${user.id}">取消激活</a></li>
                                                </c:if>
                                            </shiro:hasPermission>
                                            <%--校验授权按钮权限--%>
                                            <shiro:hasPermission name="userAuthManager">
                                                <li><a href="#" name="user_auth_btn" data-id="${user.id}">授权</a></li>
                                            </shiro:hasPermission>
                                        </ul>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
                <div id="page_div" class="text-c mt-5"></div>
            </div>
        </div>
    </div>
</section>
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-header">
        <h5><span></span></h5>
        <a class="close" data-dismiss="modal" aria-hidden="true">
            <i class="Hui-iconfont">&#xe6a6;</i>
        </a>
    </div>
    <div class="modal-body">
        <div id="show_user_info">
            <table class="table table-border table-border-top-0" style="width: 300px" align="center">
                <tr>
                    <td>用户账号</td>
                    <td><span name="username"></span></td>
                </tr>
                <tr>
                    <td>用户名称</td>
                    <td><span name="realname"></span></td>
                </tr>
                <tr>
                    <td>证件类型</td>
                    <td><span name="chineseCardType"></span></td>
                </tr>
                <tr>
                    <td>证件号码</td>
                    <td><span name="certiCard"></span></td>
                </tr>
                <tr>
                    <td>联系电话</td>
                    <td><span name="phone"></span></td>
                </tr>
                <tr>
                    <td>电子邮箱</td>
                    <td><span name="postCode"></span></td>
                </tr>
                <tr>
                    <td>联系地址</td>
                    <td><span name="addr"></span></td>
                </tr>
            </table>
        </div>
        <div id="add_user_div">
            <form id="form_add_update_user" action="${ctx}/user/register" method="post" class="form form-horizontal">
                <input type="hidden" name="id" id="id" />
                <div class="row cl">
                    <label class="form-label col-4"><span class="c-red">*</span>用户账号：</label>
                    <div class="formControls col-4">
                        <input type="text" class="input-text" value="" id="username" name="username">
                    </div>
                    <div class="col-4"></div>
                </div>
                <div class="row cl">
                    <label class="form-label col-4"><span class="c-red">*</span>登陆密码：</label>
                    <div class="formControls col-4">
                        <input type="password" class="input-text" value="" id="password" name="password">
                    </div>
                    <div class="col-4"></div>
                </div>
                <div class="row cl">
                    <label class="form-label col-4"><span class="c-red">*</span>确认密码：</label>
                    <div class="formControls col-4">
                        <input type="password" class="input-text" value="" id="re_password" name="re_password"
                               recheck="password">
                    </div>
                    <div class="col-4"></div>
                </div>
                <div class="row cl">
                    <label class="form-label col-4"><span class="c-red">*</span>用户名称：</label>
                    <div class="formControls col-4">
                        <input type="text" class="input-text" value="" placeholder="" id="realname" name="realname">
                    </div>
                    <div class="col-4"></div>
                </div>
                <div class="row cl">
                    <label class="form-label col-4"><span class="c-red">*</span>证件类型：</label>
                    <div class="formControls col-4">
                        <select id="cardType" name="cardType">
                            <option value="">-请选择-</option>
                            <option value="1">身份证</option>
                            <option value="2">组织机构代码证</option>
                        </select>
                    </div>
                    <div class="col-4"></div>
                </div>
                <div class="row cl">
                    <label class="form-label col-4"><span class="c-red">*</span>证件号码：</label>
                    <div class="formControls col-4">
                        <input class="input-text" type="text" id="certiCard" name="certiCard"/>
                    </div>
                    <div class="col-4"></div>
                </div>
                <div class="row cl">
                    <label class="form-label col-4"><span class="c-red">*</span>联系电话：</label>
                    <div class="formControls col-4">
                        <input class="input-text" type="text" id="phone" name="phone"/>
                    </div>
                    <div class="col-4"></div>
                </div>
                <div class="row cl">
                    <label class="form-label col-4"><span class="c-red">*</span>邮箱：</label>
                    <div class="formControls col-4">
                        <input class="input-text" type="text" id="email" name="email"/>
                    </div>
                    <div class="col-4"></div>
                </div>
                <div class="row cl">
                    <label class="form-label col-4"><span class="c-red">*</span>联系地址：</label>
                    <div class="formControls col-4">
                        <input class="input-text" type="text" id="addr" name="addr"/>
                    </div>
                    <div class="col-4"></div>
                </div>
            </form>
        </div>
        <%--权限控制 --%>
        <div id="auth_div">
            <form id="" action="${ctx }/res/saveAuthType" method="post" class="form form-horizontal">
                <input type="hidden" name="userId" id="userId"/>
                <div class="row cl skin-minimal text-c">
                    <label class="form-label col-3">权限类型</label>
                    <div class="formControls col-7">
                        <div class="radio-box">
                            <input type="radio" class="skin-minimal input" name="authType" id="auth-role" value="1" checked="checked"/>
                            <label for="auth-role">角色</label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" class="skin-minimal input" name="authType" id="auth-menu" value="2"/>
                            <label for="auth-menu">菜单</label>
                        </div>
                    </div>
                </div>
                <div class="row cl">
                    <div class="col-6 col-offset-3">
                        <ul id="auth-tree" class="ztree"></ul>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="modal-footer">
        <div id="add_user_div_btn">
            <a class="btn btn-primary submit" data-formid="#form_add_update_user" name="admin-role-save">保存</a>
        </div>
        <div id="auth_div_btn">
            <a class="btn btn-primary" id="save_auth_btn">保存</a>
        </div>
    </div>
</div>

<%@include file="/common/js.jsp"%>
<script type="text/javascript" src="${ctx }/lib/Validform/Validform.js"></script>
<script type="text/javascript" src="${ctx }/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="${ctx }/lib/icheck/jquery.icheck.min.js"></script>
<script type="text/javascript" src="${ctx }/js/page.js"></script>
<script type="text/javascript" src="${ctx }/js/sys_user.js"></script>
<script type="text/javascript">
    Page.page(${page.pageNo}, ${page.pageSize}, ${page.totalCount}, "formsearch");
</script>
</body>
</html>